<include file="StoreZT:header"/>
<div class="wraper space">
    <div class="list-info status">
        <div class="checkbox">
            <span class="iconfont icon-tanhao"></span>
        </div>
        <div class="product-info">
            <p>
            	<switch name="data['status']">
           			<case value="0" break="1">待付款</case>
           			<case value="1" break="1">
						<if condition="$data['picked'] eq 1">
							待提货
						<else/>
							待发货
						</if>
					</case>
           			<case value="2" break="1">待收货</case>
           			<case value="3" break="1">待评价</case>
           			<case value="4" break="1">已完成</case>
           			<case value="5" break="1">
           				<if condition="$data['api_refund_status']">
       						微支付退款失败
       					<else/>
       						申请退款
       					</if>
           			</case>
           			<case value="6" break="1">退款成功</case>
           			<case value="7" break="1">已关闭</case>
           			<case value="8" break="1">已取消</case>
           		</switch>
            </p>
            <!--<p class="address">订单金额：￥{BEESCRM:$data.order_amount}</p>-->
        </div>
    </div>
	<if condition="$data['picked'] neq 1">
		<div class="list-info order-address tb-mode">
			<p class="tb-cell"><span class="iconfont icon-location"></span></p>
			<div class="tb-cell">
				{BEESCRM:$data.username}&nbsp;&nbsp;&nbsp;&nbsp;
				{BEESCRM:$data.mobile}&nbsp;&nbsp;&nbsp;&nbsp;
				{BEESCRM:$data.address}
			</div>
		</div>
	</if>
	<div class="order-list">
		<a href="{BEESCRM::U('base/storeZT/index',array('store_id'=>$storeId))}" class="shop">
			<span class="iconfont icon-dianpu"></span>
			{BEESCRM:$title} <span class="iconfont icon-you"></span>
		</a>
		<volist name="data['StoreOrderGoods']" id="vo">
			<a href="{BEESCRM::U('base/storeZT/goodsDetail',array('store_id'=>$storeId,'goods_id'=>$vo['goods_id']))}" class="list-info order text-black">
				<div class="tb-cell product-img">
					<div><img src="{BEESCRM:$vo.goods_thumb}"></div>
				</div>
				<div class="product-info">
					<p>{BEESCRM:$vo.goods_name}</p>
					<p class="prize"><span>￥{BEESCRM:$vo.goods_price}</span> <span>X{BEESCRM:$vo.goods_num}</span></p>
					<p class="text-12">
						<if condition="$vo['discount'] gt 0">
							<span class="product-label label-bg-red">{BEESCRM:$vo.discount}折</span>
						</if>
						<if condition="$data['picked'] eq 0">
							<span class="product-label">快递</span>
							<else/>
							<span class="product-label">自提</span>
						</if>
						<if condition="$store_type eq 2">
							<if condition="$data['pay_alipay_id'] neq $alipayId">
								<span class="product-label">厂家直营</span>
							</if>
						<else />
							<if condition="$data['pay_wechat_id'] neq $wechatId">
								<span class="product-label">厂家直营</span>
							</if>
						</if>
					</p>
					<if condition="$vo['spec_1'] neq ''">
						<p>规格：{BEESCRM:$vo.spec_1} {BEESCRM:$vo.spec_2} {BEESCRM:$vo.spec_3}</p>
					</if>
				</div>
			</a>
			<if condition="$data['status'] eq 4">
				<div class="list">
					<p>
						<for start="0" end="$vo['goods_star']">
							<span class="iconfont icon-3 star"></span>
						</for>
						<for start="$vo['goods_star']" end="5">
							<span class="iconfont icon-shoucang star"></span>
						</for>
					</p>
					<p>{BEESCRM:$vo.goods_comment}</p>
				</div>
				<elseif condition="$data['status'] eq 3" />
				<p class="list comment goods-star" data-id="{BEESCRM:$vo.order_goods_id}">评价
		            <span class="pull-right">
		                <a href="javascript:;" class="iconfont icon-3 star comment-star"></a>
		                <a href="javascript:;" class="iconfont icon-3 star comment-star"></a>
		                <a href="javascript:;" class="iconfont icon-3 star comment-star"></a>
		                <a href="javascript:;" class="iconfont icon-3 star comment-star"></a>
		                <a href="javascript:;" class="iconfont icon-3 star comment-star"></a>
		            </span>
				</p>
				<textarea placeholder="收到宝贝啦！赶快来分享吧" class="goods-comment"></textarea>
			</if>
		</volist>
		<if condition="$data['status'] eq 3">
			<div class="big-btn normal-btn">
				<a href="javascript:void(0)" class="btn" id="submit">提交评价</a>
			</div>
		</if>
		<div class="list">
			<p class="text-right">
				共 <span class="strong-red">{BEESCRM:$data.StoreOrderGoods|count}</span> 件商品 &nbsp;&nbsp;&nbsp;
				优惠：<span class="strong-red">￥{BEESCRM:$data.discount}</span>
			</p>
			<p class="text-right">
				合计：<span class="strong-red">￥{BEESCRM:$data.order_amount}</span></p>
		</div>
	</div>
<!--
    <div class="order-list">
        <a href="#" class="shop"><span class="iconfont icon-dianpu"></span>{BEESCRM:$title}<span class="iconfont icon-you"></span></a>
        <volist name="data['StoreOrderGoods']" id="vo">
	        <div class="list-info order">
	            <div class="product-img"><img src="{BEESCRM:$vo.goods_thumb}"></div>
	            <div class="product-info">
	                <p>{BEESCRM:$vo.goods_name}</p>
	                <p class="prize"><span>￥{BEESCRM:$vo.goods_price}</span> <span>X{BEESCRM:$vo.goods_num}</span></p>
	                <if condition="$vo['spec'] neq ''">
	                <p>规格：{BEESCRM:$vo.spec}</p>
	                </if>
	            </div>
	        </div>

	    </volist>

    </div>
-->

	<div class="order-info">
		<if condition="$data['ship_code']">
			<a href="javascript:void(0)" class="list wuliu">
				承运来源：{BEESCRM:$data.ship_type}
        		<span class="pull-right mail-num">
        			运单号：{BEESCRM:$data.ship_code}
        		</span>
			</a>
			<elseif condition="$data['ship_time']"/>
			<a href="javascript:void(0)" class="list wuliu">
				{BEESCRM:$data.ship_type}
        		<span class="pull-right mail-num">
        			{BEESCRM:$data.ship_type_code}
        		</span>
			</a>
		</if>
	</div>
    <div class="order-info">
        <p class="list">运费：￥{BEESCRM:$data.freight}</p>
        <p class="list">实付款（含运费）：￥{BEESCRM:$data.order_amount}</p>
        <p class="list">订单号：{BEESCRM:$data.order_sn}</p>
        <p class="list">买家留言：
        	<if condition="$data['remark']">{BEESCRM:$data.remark}<else/>无</if>
        </p>
        <if condition="$data['refund_reason'] neq null">
        <p class="list">申请退款方式：
        <if condition="$data['refund_type'] eq 0">退货退款<else/>退货退款</if></p>
        <p class="list">申请退款原因：{BEESCRM:$data.refund_reason}</p>
        </if>
        <if condition="$data['refuse_reason'] neq null" >
        	<p class="list">退款审核操作原因：{BEESCRM:$data.refuse_reason}</p>
        </if>
        <if condition="$data['close_reason']">
        	<p class="list">关闭原因：{BEESCRM:$data.close_reason}</p>
        </if>
        <p class="list order-time">
        	下单时间：{BEESCRM:$data.create_time|date="Y-m-d H:i:s",###}<br/>
        	<if condition="$data['pay_time']">
        		付款时间：{BEESCRM:$data.pay_time|date="Y-m-d H:i:s",###}<br/>
        	</if>
        	<if condition="$data['ship_time']">
        		发货时间：{BEESCRM:$data.ship_time|date="Y-m-d H:i:s",###}<br/>
        	</if>
        	<if condition="$data['receive_time']">
        		收货时间：{BEESCRM:$data.receive_time|date="Y-m-d H:i:s",###}<br/>
        	</if>
        	<if condition="$data['finish_time']">
        		<if condition="$data['status'] eq 7">关闭<else/>完成</if>时间：{BEESCRM:$data.finish_time|date="Y-m-d H:i:s",###}<br/>
        	</if>
    </div>
	<!-- <div style="width: 60%;margin: 20px auto 0;">
		<img src="/assets/store/common/images/prcode.jpg"/>
	</div> -->
    <!-- <div class="btn-box bottom">
        <p><span class="account">合计：<span>￥{BEESCRM:$data.order_amount}</span></span></p>
        <a href="#" class="btn">取消订单</a>
        <a href="#" class="btn pay">确认付款</a>
    </div> -->
</div>
<include file="StoreZT:commonJs" />
<script type="text/javascript">
	//星级评价
	$('body').on('click','.comment-star',function(){
		$(this).removeClass('icon-shoucang').addClass('icon-3');
		$(this).prevAll().removeClass('icon-shoucang').addClass('icon-3');
		$(this).nextAll().removeClass('icon-3').addClass('icon-shoucang');
	});
	
	//提交
	$(document).on('click','#submit',function(){
		var data=[];
		var store_id = {BEESCRM:$storeId};
		var json={};
		var order_id="{BEESCRM:$data.order_id}";
		var star,comment,goods_id;
		$('.goods-star').each(function(key,val){
			goods_id=$(this).data('id');
			star=$(this).find('.icon-3').length;
			comment=$(this).next('textarea').val();
			if(!comment){
				comment='好评';
			}
			data.push({'order_goods_id':goods_id,'goods_star':star,'goods_comment':comment});
		});
		json.data={'data':data};
		json.url='/base/storeZT/comment/order_id/'+order_id+'/store_id/'+store_id;
		json.method='post';
		json.type='json';
		$.getAjax(json,true,goback);
	});
	
	function goback(){
		setTimeout('location.href=document.referrer',3000);
	}
</script>
<include file="StoreZT:footer" />